package Test;

import java.io.File;
import java.io.PrintWriter;

public class Printwriter
{
    public static void main(String[] args){
        try{
            File file = new File("filename.txt");
            if(!file.exists()){
                file.createNewFile();
            }

            PrintWriter pr= new PrintWriter(file);

            pr.println("111111");

            pr.println("测试");
            pr.write("测试111");
            pr.write("1234556");
            pr.close();

            System.out.println("完成");

        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
